package com.dangdang.domain;

import org.apache.commons.lang.StringUtils;

public class Category {

	private Integer id;
	private String name;
	private int parentId;
	private String catValue;

	public Category() {
	}

	public int getLevel() {
		return StringUtils.countMatches(catValue, "|");
	}

	public Category(Integer id, String name) {
		this.id = id;
		this.name = name;
	}

	public Category(Integer id, String name, int parentId) {
		this.id = id;
		this.name = name;
		this.parentId = parentId;
	}

	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getParentId() {
		return this.parentId;
	}

	public void setParentId(int parentId) {
		this.parentId = parentId;
	}

	public String getCatValue() {
		return catValue;
	}

	public void setCatValue(String catValue) {
		this.catValue = catValue;
	}

}
